using System;
using Extensions.FPMath;
using Unity.Entities;

namespace Game.Core
{
    [Serializable]
    public unsafe struct AdvancedPropertyData
    {
        public float Strength; // 力量
        public float Dexterity; // 敏捷
        public float Constitution; // 体质
        public float Intellectual; // 智力
        public float Lucky; // 幸运
        public float Charisma; // 魅力
        
        public static AdvancedPropertyData operator +(AdvancedPropertyData a) => a;

        public static AdvancedPropertyData operator -(AdvancedPropertyData a) =>
            new AdvancedPropertyData()
            {
                Strength = -a.Strength,
                Dexterity = -a.Dexterity,
                Constitution = -a.Constitution,
                Intellectual = -a.Intellectual,
                Lucky = -a.Lucky,
                Charisma = -a.Charisma,
            };

        public AdvancedPropertyData Add(AdvancedPropertyData* p)
        {
            AdvancedPropertyData r = new AdvancedPropertyData();
            r.Strength = Strength + p->Strength;
            r.Dexterity = Dexterity + p->Dexterity;
            r.Constitution = Constitution + p->Constitution;
            r.Intellectual = Intellectual + p->Intellectual;
            r.Lucky = Lucky + p->Lucky;
            r.Charisma = Charisma + p->Charisma;
            return r;
        }
        public static AdvancedPropertyData operator +(AdvancedPropertyData a, AdvancedPropertyData* b) => a.Add(b);
        public static AdvancedPropertyData operator +(AdvancedPropertyData a, AdvancedPropertyData b) => a.Add(&b);
        public AdvancedPropertyData Subtract(AdvancedPropertyData* p) => this + -(*p); 
        public static AdvancedPropertyData operator -(AdvancedPropertyData a, AdvancedPropertyData b) => a + (-b);
    }
}